#include "bullet.h"
#include "GameSetting.h"
#include <QGraphicsScene>
#include <QPixmap>
using namespace GameSetting;
Bullet::Bullet(QGraphicsItem *parent):QGraphicsPixmapItem(parent) {
    setPixmap(QPixmap(":/image/Bullet_2.png"));
    setScale(BulletScale);
    startTimer(BulletTimer);

}


void Bullet::timerEvent(QTimerEvent *event)
{
    setPos(x(),y()-BulletSpeed);
    //子弹尾巴出去销毁
    if(y()+boundingRect().height()<0){
        scene()->removeItem(this);
        delete this;
    }
}
